package rl.prog2.demos.container.iterator;

import java.util.Iterator;

public class myArrayListIterator implements Iterator<Object> {

	private MyArrayList list;
	private int curr;

	public myArrayListIterator(MyArrayList list) {
		this.list = list;
	}

	@Override
	public boolean hasNext() {

		return list.size() > curr;
	}

	@Override
	public Object next() {
		return list.get(curr++);
	}

	@Override
	public void remove() {
//		throw new UnsupportedOperationException();
		list.remove(curr--);

	}

}
